/* 1000元硬币换零 */

#include<iostream>
using namespace std;

int main(void)
{
	for (int i = 0; i <= 2; i++)
	{
		int left = 1000 - 500 * i;
		int jMax = left / 100;
		for (int j = 0; j <= jMax; j++)
		{
			int left1 = left - 100 * j;
			int kMax = left1 / 50;
			for (int k = 0; k <= kMax; k++)
			{
				int left2 = left1 - 50 * k;
			       	int m = left2 / 10;

				if (i + j + k + m <= 15)
				{
					for (int n = 0; n < i; n++)
					{
						cout<< "500 ";
					}
					for (int n = 0; n < j; n++)
					{
						cout<< "100 ";
					}
					for (int n = 0; n < k; n++)
					{
						cout<< "50 ";
					}
					for (int n = 0; n < m; n++)
					{
						cout<< "10 ";
					}
					cout<< "\n";
				}
			}
		}
	}

	return 0;
}
